import { Controller, Get, Inject, Query } from '@nestjs/common';
import * as Minio from 'minio';
import {
  ApiTags,
  ApiOperation,
  ApiBearerAuth,
  ApiResponse,
} from '@nestjs/swagger';

@ApiTags('图片上传')
@Controller('minio')
export class MinioController {
  @Inject('MINIO_CLIENT')
  private minioClient: Minio.Client;

  @Get('presignedUrl')
  @ApiOperation({
    summary: '获取预签名',
    description: '获取预签名接口',
  })
  presignedPutObject(@Query('name') name: string) {
    return this.minioClient.presignedPutObject('dev', name, 3600);
  }
}
